Skip to content

feat(hydra): use hydra:memberAssertion instead of owl:equivalentClass#7944

Merged
soyuka merged 1 commit intoapi-platform:mainfrom
abderrahimghazali:feat/hydra-member-assertion
May 6, 2026
Merged

feat(hydra): use hydra:memberAssertion instead of owl:equivalentClass#7944
soyuka merged 1 commit intoapi-platform:mainfrom
abderrahimghazali:feat/hydra-member-assertion

Conversation

@abderrahimghazali
Copy link
Copy Markdown
Contributor

Q A
Branch? main
Bug fix? no
New feature? yes
Deprecations? no
Issues Fixes #2827
License MIT

Summary

Per the Hydra Core spec (introduced in HydraCG/Specifications#195 and later renamed managesmemberAssertion), entrypoint collection properties now declare what kind of resources they manage via a hydra:memberAssertion block rather than the legacy owl:equivalentClass/owl:allValuesFrom restriction.

The Hydra JSON-LD vocabulary already exposes memberAssertion, subject, property, and object (see src/JsonLd/HydraContext.php); hydra:manages is now flagged as archaic with a comment pointing to hydra:memberAssertion. This PR aligns the documentation output with the modern term and removes the awkward OWL block dunglas pointed to in the issue.

Before

"range": [
  {"@id": "hydra:Collection"},
  {
    "owl:equivalentClass": {
      "owl:onProperty": {"@id": "hydra:member"},
      "owl:allValuesFrom": {"@id": "#Book"}
    }
  }
]

After

"range": "hydra:Collection",
"hydra:memberAssertion": {
  "hydra:property": {"@id": "rdf:type"},
  "hydra:object": {"@id": "#Book"}
}

Changes

  • src/Hydra/Serializer/DocumentationNormalizer.php — replace the owl:equivalentClass block with hydra:memberAssertion in populateEntrypointProperties().
  • src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php — update both prefixed and prefix-less fixtures (testNormalize, testNormalizeWithoutPrefix).

Follow-up

api-platform/api-doc-parser currently parses the owl:equivalentClass block to discover member types — it will need a follow-up patch to read hydra:memberAssertion instead. Filing this as draft pending that patch.

Test plan

  • vendor/bin/phpunit src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php — 7/7 pass
  • vendor/bin/phpunit src/Hydra/Tests — 50/50 pass
  • vendor/bin/phpunit tests/JsonLd — 21/21 pass

Per the Hydra Core spec (hydra-cg.com/spec/latest/core/), entrypoint
collection properties now declare member semantics via a
`hydra:memberAssertion` block (subject/property/object) rather than the
legacy `owl:equivalentClass`/`owl:allValuesFrom` restriction. Aligns
the API documentation with the modern term and removes the awkward
OWL block.

Refs api-platform#2827, HydraCG/Specifications#195
@abderrahimghazali abderrahimghazali marked this pull request as ready for review May 1, 2026 17:40
@soyuka soyuka merged commit 72b02af into api-platform:main May 6, 2026
119 checks passed
@soyuka
Copy link
Copy Markdown
Member

soyuka commented May 6, 2026

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for hydra:manages

2 participants